package com.zhengxiang.onlinexamination.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zhengxiang.onlinexamination.dao.SettingMapper;
import com.zhengxiang.onlinexamination.entity.Setting;
import com.zhengxiang.onlinexamination.service.SettingService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 配置表(ZSetting)表服务实现类
 *
 * @author 
 * @since 2023-03-10 11:43:12
 */
@Service("zSettingService")
public class SettingServiceImpl extends ServiceImpl<SettingMapper, Setting> implements SettingService {


    @Resource
    private SettingMapper settingMapper;

    @Override
    public List<Setting> querySettingList(Integer type) {
        QueryWrapper<Setting> q = new QueryWrapper<Setting>();
        if (type != null) {
            q.lambda().eq(Setting::getGroupType, type);
        }
        return settingMapper.selectList(q);
    }

    @Override
    public Setting querySetting(Integer groupType,Integer setType) {
        QueryWrapper<Setting> q = new QueryWrapper<Setting>();
        if (groupType != null && setType != null) {
            q.lambda().eq(Setting::getGroupType, groupType).eq(Setting::getSetType,setType);
        }
        return settingMapper.selectOne(q);
    }
}

